package sg.tua.game;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Vector2f;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

import sg.tua.debug.DB;
import sg.tua.hud.HudAnimationFactory;
import sg.tua.hud.MoveableHudAnimation;

public class CookingState extends BasicGameState {

	private static enum COOKING_STATES { MEAL_STATE, INGREDIENT_STATE };
	 
	private COOKING_STATES  currentState;	
	int stateID = -1;
	Kitchen kitchen;
	
	
	CookingState(int id){
		stateID = id;
	}
	
	@Override
	public int getID() {
		return stateID;
	}
	
	@Override
	public void enter(GameContainer gc, StateBasedGame game)
			throws SlickException {
		currentState = COOKING_STATES.MEAL_STATE;
		kitchen.RegisterMousListeners(gc);
	}
	
	@Override
	public void init(GameContainer gc, StateBasedGame sb)
			throws SlickException {
		kitchen = new Kitchen();
		kitchen.setBackGround("data/cookingBackground.png");
		kitchen.addMeal("NewMeal", "data/Apple.png");
		kitchen.addMeal("Apple", "data/Apple.png");
	}

	@Override
	public void render(GameContainer gc, StateBasedGame sb, Graphics g)
			throws SlickException {
		kitchen.getBackGround().render(g);
		
		DB.wl("CookingState", g);
		switch(currentState){
			case MEAL_STATE:
				kitchen.renderMeals(g);
			case INGREDIENT_STATE:
				//kitchen.renderMeals(g);
		}
		
	}

	@Override
	public void update(GameContainer gc, StateBasedGame sb, int delta)
			throws SlickException {
		Input input = gc.getInput();
		
		switch(currentState){
			case MEAL_STATE:
				MoveableHudAnimation clickee = kitchen.getClicked();
				if (clickee != null) currentState = COOKING_STATES.INGREDIENT_STATE;
			case INGREDIENT_STATE:
		}		 
		int mouseX = input.getMouseX();
		int mouseY = input.getMouseY();
	}


}
